package com.chen.mapper;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chen.entity.Menu;
import com.chen.entity.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import com.chen.vo.UserPasswordDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author personcoder007
 * @since 2022-07-17
 */
@Mapper
public interface UserMapper extends BaseMapper<User> {
//    分页
   Page<User> findPage(@Param("page") Page<User> page,
                       @Param("params")HashMap<String,Object> params);


   @Update("update user set password = #{newPassword} where username = #{username} and password = #{password}")
   int updatePassword(UserPasswordDTO userPasswordDTO);

   /**
    * 查询详细信息
    * @return
    */
   List<Menu> selectUserDetail(@Param("userId") Integer userId);

   @Select("select *from user where open_id=#{openId}")
   User getOpenid(String openId);
}
